import csv
import numpy as np
import statistics
def read_class_data(csv_name):
    with open(csv_name,'r') as file:
        reader = csv.reader(file)
        next(reader)
        return list(reader)
class1_data = read_class_data('class1.csv')
class2_data = read_class_data('class2.csv')
class3_data = read_class_data('class3.csv')
all_class_data = class1_data + class2_data + class3_data
all_class_scores = []
for data in all_class_data:
    all_class_scores.append(int(data[2]))
scores_np = np.array(all_class_scores)
print(scores_np)
#计算平均值
mean_score = np.mean(scores_np)
#计算中位数
median_score = np.median(scores_np)
#计算众数
mode_value = statistics.mode(scores_np)
#计算标准差
std_score = np.std(scores_np)
#计算方差
var_score = np.var(scores_np)

print(f"平均值为：{mean_score}")
print(f"中位数为：{median_score}")
print(f"众数为：{mode_value}")
print(f"标准差为：{std_score}")
print(f"方差为：{var_score}")
